<form method="post" action="<?php echo U('del');?>" id="myform">
<table class="table table-border table-bg table-hover yzm-table-sort">
<thead>
  <tr class="text-c">
	<th width="50" style="padding:5px;">排名</th>
	<th width="40" style="padding:5px;">图片</th>
	<th style="padding:5px;" class="hidden-xs hidden-sm">款式编码</th>
	<th style="padding:5px;" class="hidden-xs hidden-sm">颜色</th>
	<th style="padding:5px;" class="text-l">商品名称</th>
	<th style="padding:5px;" class="hidden-xs hidden-sm" class="text-l">品牌</th>
	<th width="80" style="padding:5px;">销量</th>
	<th width="50" style="padding:5px;">趋势</th>
  </tr>
</thead>
<tbody>
	<?php 
	foreach($data as $val){
		if(strpos($val['pic'],'://')){
			$val['pic'] = 'https://'.explode('://',$val['pic'])[1];
		}
	?>
	  <tr class="text-c">
		<td style="padding:5px;"><?php echo $val['id']?></td>
		<td style="padding:5px;">
		<a style="padding:5px;" href="javascript:;" style="text-decoration:none" onclick="yzm_show_img('<?php echo $val['pic']?>',600,600)"><img src="<?php echo $val['pic']?>" height="35" style="max-width:100px" onmouseover="yzm_img_browse(this, '<?php echo $val['pic']?>')" onmouseout="layer.closeAll('tips')"></a>
		</td>
		<td style="padding:5px;" class="hidden-xs hidden-sm"><a target="_blank" class="c-primary" href="https://category.vip.com/suggest.php?keyword=<?php echo $val['i_id'];?>"><?php echo $val['i_id']?></a></td>
		<td style="padding:5px;" class="hidden-xs hidden-sm"><?php echo $val['color']?></td>
		<td class="text-l" style="padding:5px;"><div><?php echo $val['name']?></div></td>
		<td class="text-c hidden-xs hidden-sm" style="padding:5px;"><?php echo $val['brand']?></td>
		<td style="padding:5px;"><?php echo $val['qty']?></td>
		<td style="padding:5px;">
		<?php if($val['trend']==0){
			$class = 'label-default';
			$text = '持平';
			$txt = '平';
		}else if($val['trend']>0){
			$class = 'label-danger';
			$text = '上升'.$val['trend'].'%';
			$txt = '升';
		}else if($val['trend']<0){
			$class = 'label-success';
			$text = '下降'.($val['trend']*-1).'%';
			$txt = '降';
		} ?>
		 <span onmouseover="yzm_tips=layer.tips('<?php echo $text;?>，点击查看详情', this)" onmouseout="layer.close(yzm_tips);"><a href="javascript:;" class="i_id" i_id="<?php echo $val['i_id'].$val['color'];?>" title="查看统计"><span class="label radius <?php echo $class;?>"><?php echo $txt;?></span></span></span>
		</td>
	  </tr>		
	<?php 
	}
	?>
</tbody>
</table>
<?php if(!$data){ ?><div class="yzm_no_data"><i class="Hui-iconfont">&#xe6e0;</i> 暂无数据</div><?php } ?>
</form>
<div style="text-align:center;margin-top:3px;" id="page">
	<a href="javascript:page_prev()" title="上一页" class="btn">上一页</a>
	<a href="javascript:page_next()" title="下一页" class="btn">下一页</a>
</div>
<script>
$('.i_id').on('click',function(){
	let i_id = $(this).attr('i_id');
	let url = '<?php echo U('jst_admin/trend',['type'=>'i_id'])?>'+'?kuan='+i_id;
	let width = '800px';
	if(screen.width<800){
		width = '100%';
	}
	layer.open({  
		type: 2,  
		title: i_id+'销量统计',  
		shadeClose: true,  
		shade: 0.2,  
		area: [width, '600px'],  
		content: url,
		success: function(layero, index){
			
		}
	})
	return false;
})
</script>
  